package ppms.commons.data.view;

import ppms.commons.data.IDataTypeConvert;
import ppms.commons.data.controller.ITreeViewController;
import ppms.commons.data.entity.IDataEntity;

public abstract class AbsDataTreeView implements IDataTreeView
{

    private ITreeViewController	   viewController	= null;

    private IDataEntity		   current	       = null;

    private IDataTypeConvert	   typeConvert	   = null;

    
    public AbsDataTreeView()
    {
	
    }

    //控制器
    public ITreeViewController getDataController()
    {
	return this.viewController;
    }
    public void setDataController(ITreeViewController controller)
    {
	this.viewController = controller;
    }
    
    //事件
    public void onCollapse(IDataEntity dataEntity)
    {
	this.getDataController().onCollapse(dataEntity);
    }

    public void onExpand(IDataEntity dataEntity)
    {
	this.getDataController().onExpand(dataEntity);
    }

    public void onSelectChanged(IDataEntity dataEntity)
    {
	this.getDataController().onSelectChanged(dataEntity);
    }

    public void onSelected(IDataEntity dataEntity)
    {
	this.getDataController().onSelected(dataEntity);
	this.setCurrent(dataEntity);
    }
    
    //当前节点
    public IDataEntity getCurrent()
    {
	return this.current;
    }
    public void setCurrent(IDataEntity dataEntity)
    {
	this.current = dataEntity;
    }
    
    //类型转换器
    public IDataTypeConvert getDataTypeConvert()
    {
	return this.typeConvert;
    }

    public void setDataTypeConvert(IDataTypeConvert typeConvert)
    {
	this.typeConvert = typeConvert;
    }

}
